package com.chinaunicom.jdbc;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/1/14 9:27
 * Description:
 */
public class OrderRowMapper implements RowMapper {


    @Override
    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
        // 底层实现: this.rowMapper.mapRow(rs, rowNum++): 将查询到的一行封装为一个对象
        Order order =
                new Order(rs.getString("id"), rs.getString("name"), rs.getInt("count"));
        return order;
    }
}
